
package me.haoliang

import akka.actor.{Actor, ActorSystem, Props}
import akka.event.Logging
import com.typesafe.config.ConfigFactory

/**
  * author: planck 
  * createTime: 2016/10/31.
  */
class AkkaScala extends Actor {
  val log = Logging(context.system, this)

  override def receive = {
    case x: String => log.info(x)
  }

}


object AkkaScala {

  val system = ActorSystem.create("mySystem", ConfigFactory.load("akka/myApplication.conf"))
  val myActor = system.actorOf(Props[AkkaScala], "myActor")
  //地址对应actorSystemName 和 actorRef名称
  val remoteActor = system.actorSelection("akka.tcp://myActorService@127.0.0.1:2552/user/myActor");

  def main(args: Array[String]): Unit = {
    for (i <- 1 to 10)
      remoteActor !("11", myActor);
  }
}

